package gui;

import javax.swing.table.*; 
import javax.swing.event.TableModelListener; 
import javax.swing.event.TableModelEvent; 

//////////////////////////////////////////////////////////////////////////
//// TableMap
/**

@author Ivan Jeukens
@version v 0.1 11/10/2002
*/
public class TableMap extends AbstractTableModel implements TableModelListener {

    ///////////////////////////////////////////////////////////////////
    ////                         public methods                    ////  
    
    public void setModel(TableModel model) {
        _model = model; 
        model.addTableModelListener(this); 
    }

    public TableModel getModel() {
        return _model;
    }
    
    public Object getValueAt(int aRow, int aColumn) {
        return _model.getValueAt(aRow, aColumn); 
    }
        
    public void setValueAt(Object aValue, int aRow, int aColumn) {
        _model.setValueAt(aValue, aRow, aColumn); 
    }

    public int getRowCount() {
        return (_model == null) ? 0 : _model.getRowCount(); 
    }

    public int getColumnCount() {
        return (_model == null) ? 0 : _model.getColumnCount(); 
    }
        
    public String getColumnName(int aColumn) {
        return _model.getColumnName(aColumn); 
    }

    public Class getColumnClass(int aColumn) {
        return _model.getColumnClass(aColumn); 
    }
        
    public boolean isCellEditable(int row, int column) { 
         return _model.isCellEditable(row, column); 
    }

    public void tableChanged(TableModelEvent e) {
        fireTableChanged(e);
    }

    ///////////////////////////////////////////////////////////////////
    ////                    protected variables                    ////

    protected TableModel _model;
}
